<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>

    <title>找房无忧-首页</title>
    <link rel="stylesheet" href="css/reset.css"/>
    <link rel="stylesheet" href="css/index.css"/>
    <script src="https://code.jquery.com/jquery-3.4.1.js" rel="script" type="text/javascript"></script>
    <script src="js/public.js" rel="script" type="text/javascript"></script>
</head>
<body>
<!--头部-->
<header>
    <h1><a href="#"><img src="image/index/logo.jpg" alt=""/></a></h1>

    <div class="icon">
        <a href="my.html"><img src="image/index/my.jpg" alt=""/></a>
    </div>
</header>



<!--热门房源-->
<section class="hotHouse">
    <h2>
        <strong>热门房源</strong><br/>
        <span> Hot house</span>
    </h2>
    <ul class="houseList" id="houseList">

    </ul>

</section>




<script src="js/rem.js"></script>
<script>

    $.ajax({
        url: baseUrl + "/tenement/list?page=1&limit=10",
        dataType:"json",
        success:function (res) {
            var str = "";
            for (var i = 0 ; i < res.data.length ; i++) {
                str += "<a href=\"rentalDetails.html?id="+res.data[i].id+"\">\n" +
                    "<li>\n" +
                    "<div class=\"img\"><img src=\""+ res.data[i].imgSrc +"\" alt=\"\"/></div>\n" +
                    "<div class=\"text\">\n" +
                    "<h3>"+ res.data[i].title +"</h3>\n" +
                    "<p>"+ res.data[i].houseType + res.data[i].orientation +" <strong>"+ res.data[i].sumPrice +"万</strong></p>\n" +
                    "<p>" + res.data[i].community + " <span>" +res.data[i].unitPrice+ "元/平</span></p>\n" +
                    "<p>\n";

                for (var j = 0; j < res.data[i].labelList.length; j++) {
                    str += "<a href=\"#\">" + res.data[i].labelList[j].title + "</a>";
                }
                    str += "</p>\n" +
                    "</div>\n" +
                    "</li>\n" +
                    "</a>";
            }

            if (str == "") {
                $("#houseList").html("<li>暂无数据</li>");
            }else {
                $("#houseList").html(str);
            }
        },
        error:function () {
            alert("错误");
        }
    })
</script>
</body>
</html>